package pri.damai.xiaowu.usercenter.sysauth.covert;

import org.springframework.beans.BeanUtils;
import pri.damai.xiaowu.usercenter.sysauth.entity.SysResource;
import pri.damai.xiaowu.usercenter.vo.ResourceVO;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 系统资源转换器
 *
 * @description
 * @author YangXinFu
 * @date 13:59 2022/7/20
 **/
public class ResourceConverter {

    public static List<ResourceVO> covertToResourceVO(List<SysResource> resources) {
        return resources.stream().map(sysResource -> {
            ResourceVO resourceVO = new ResourceVO();
            BeanUtils.copyProperties(sysResource, resourceVO);
            return resourceVO;
        }).collect(Collectors.toList());
    }

}
